#include "threadPool.hpp"
#include <ctime>
#include <cstdlib>
#include "Task.hpp"
#include "log.hpp"

int main()
{
    srand((uint64_t)time(nullptr) ^ 0x52251);

    ThreadPool<Task>* tp = ThreadPool<Task>::getThreadPool();

    tp->run();
    
    while (true)
    {
        int x = rand() % 100 + 1;
        usleep(1000);
        int y = rand() % 100 + 1;
        Task t(x, y, [](int x, int y)->int {
            return x + y;
        });

        logMessage(DEBUG, "制作任务完成: %d + %d = ?", x, y);

        tp->pushTask(t);

        sleep(1);
    }
    return 0;
}
